
import 'package:flutter/material.dart';
import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
import 'package:valovault_reminder/common/ui/val_auto_fit_screen_size.dart';

import '../../../common/config/val_assets_name.dart';
import '../../../common/ui/val_ui_kit_btn.dart';
import '../../../common/ui/val_ui_kit_base_colors.dart';
import '../../../common/ui/val_ui_kit_dialog_impl.dart';
import '../../../common/ui/val_common_text.dart';

class ValNoticeRechargeAlertView extends StatelessWidget {
  final Callback onCost;
  final Callback onSure;

  const ValNoticeRechargeAlertView(this.onSure, this.onCost, {super.key});

  @override
  Widget build(BuildContext context) {
    return Padding(
        padding: EdgeInsets.only(left: 30.w, right: 30.w),
        child: Center(
          child:  Container(
            height: 415.w,
            width: 309.w,
            // padding: EdgeInsets.all(20.w),
            decoration: BoxDecoration(
              color: Colors.transparent,
              borderRadius:  BorderRadius.circular(24.w),
              image: const DecorationImage(
                  image: AssetImage('${ValAssetsName.ASSETS_Message}val_notice_recharge_alert_ground.png'),
                  fit: BoxFit.fill),
            ),
            child: Stack(
              children: [
                Positioned(
                  top: 44, right: 32,
                  child: GestureDetector(
                      onTap: () => ValUIKitDialogImpl.closeDialog(),
                      child: Image.asset('${ValAssetsName.ASSETS_HOME}val_home_car_delete_btn.png', width: 25, height: 25),
                  ),
                ),

                Positioned(
                  bottom: 36, left: 10, right: 10,
                  child: Container(
                    alignment: Alignment.center,
                    child: SizedBox(
                        height: 54.w,
                        child: _buildAgreeBtn()
                    ),
                  ),
                ),

                // 消费
                Positioned(
                  bottom: 75, left: 10, right: 28,
                  child: Container(
                    alignment: Alignment.centerRight,
                    child: SizedBox(
                        height: 39.w,
                        child: _buildCostBtn()
                    ),
                  ),
                ),
              ],
            ),
          ),
        )
    );
  }

  Widget _buildCostBtn() {
    return ValUIKitBtn(Container(
        height: 39.w,
        width: 82.w,
        decoration: const BoxDecoration(
          image: DecorationImage(
              image: AssetImage('${ValAssetsName.ASSETS_Message}val_notice_recharge_alert_recharge.png'),
              fit: BoxFit.fitWidth),
        ),
        child: Container(
          margin: const EdgeInsets.only(top: 5, left: 5),
          alignment: Alignment.topCenter,
          child: Row(
            children: [
              Image.asset('${ValAssetsName.ASSETS_Message}val_notice_recharge_alert_coin.png', width: 17, height: 17,),
              const Padding(padding: EdgeInsets.only(left: 4)),
              ValCommonText.oneLine('10 coins', 10.w, Colors.black, fontWeight: FontWeight.w600,),
            ],
          ),
        ),
    ),(){
      ValUIKitDialogImpl.closeDialog();
      onCost();
    },);
  }

  Widget _buildAgreeBtn() {
    return ValUIKitBtn(Container(
      height: 54.w,
      width: 181.w,
      alignment: Alignment.center,
      decoration: BoxDecoration(
        color: const Color(0xFF333333),
        borderRadius: BorderRadius.circular(27.w),
      ),
      child: Image.asset('${ValAssetsName.ASSETS_Message}val_notice_recharge_alert_btn.png', width: 181, height: 54, fit: BoxFit.fill,)

      // child: Center(
      //   child: CSCommonText.oneLine('Sure', 20.w,
      //     CSCommonColors.white,
      //     fontWeight: FontWeight.w500,
      //     textAlign:  TextAlign.center,),
      // ),
    ),(){
      ValUIKitDialogImpl.closeDialog();
      onSure();
    },);
  }
}
